home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / AppsToGo.docs / =AppWannabe.fn.desc < prev    next >
Encoding:
Text File  |  1993-03-18  |  12.4 KB  |  259 lines  |  [TEXT/MPS ]

  1. /* These functions are generally found in an application that is using the
  2. ** application framework portion of DTS.Lib (DTS.framework).  Most of these
  3. ** functions are called by the DTS.framework, and therefore must be included
  4. ** in your application. */
  5.  
  6.  
  7.  
  8. /************** DoEvent.c **************/
  9.  
  10. void            DoEvent(EventRecord *event);
  11. /* You definitely want to modify this function.  This is the main dispatcher for
  12. ** the application event loop.  Change the code for the different cases as is
  13. ** appropriate for your application. */
  14.  
  15. void            DoActivate(WindowPtr window);
  16. /* • Called by DTS.framework. • */
  17. /* This function activates or deactivates the window, as appropriate.  It changes
  18. ** the state of the window controls and grow icon.  If there is anything else
  19. ** that needs to be done for your application's windows during activation or
  20. ** deactivation, then it needs to be done here. */
  21.  
  22.  
  23.  
  24. /************** EventLoop.c **************/
  25.  
  26. void            EventLoop(void);
  27. /* This is the main application event loop.  It simply calls WaitNextEvent
  28. ** and DoEvent until the user decides to quit. */
  29.  
  30. void            DoCursor(void);
  31. /* • Called by DTS.framework. • */
  32. /* Handle the cursor changes.  Most of the work is done by the application
  33. ** framework.  Each window has its own cursor calculation proc, so you
  34. ** shouldn't have to add any code here.  You may wish to do some special
  35. ** stuff prior to the DoWindowCursor call if you have modeless dialogs. */
  36.  
  37.  
  38.  
  39. /************** File.c **************/
  40.  
  41. OSErr            InitDocument(FileRecHndl frHndl);
  42. /* • Called by DTS.framework. • */
  43. /* This function is where you do the application specific document
  44. ** initialization things.  This function is automatically called at
  45. ** appropriate times by DTS.framework. */
  46.  
  47. long            InitDocumentSize(OSType sftype);
  48. /* • Called by DTS.framework. • */
  49. /* This function is used to return the document size, given an OSType. */
  50.  
  51.  
  52.  
  53. /************** Help.c **************/
  54.  
  55. void            DynamicBalloonHelp(void);
  56. /* This function is used to do balloon help for the content of a window. */
  57.  
  58.  
  59.  
  60. /************** IdleTasks.c **************/
  61.  
  62. void            DoIdleTasks(EventRecord *event);
  63. /* If your application has an tasks that need to be done at idle time, this
  64. ** is the place to put them.  It is automatically called at appropriate times
  65. ** by DTS.framework. */
  66.  
  67.  
  68.  
  69. /************** Menu.c **************/
  70.  
  71. void            DoAdjustMenus(void);
  72. /* • Called by DTS.framework. • */
  73. /* This function is where your application would make menu changes, such as
  74. ** enabling or disabling menu choices, adding or removing menu items, etc. */
  75.  
  76. void            DoMenuCommand(long menuResult);
  77. /* This function is where your application would respond to menu commands. */
  78.  
  79. Boolean            DoAdjustFileMenu(WindowPtr window);
  80. /* This function shows the kind of stuff you do to adjust menu items. */
  81.  
  82. Boolean            DoAdjustEditMenu(WindowPtr window);
  83. /* This function shows the kind of stuff you do to adjust menu items. */
  84.  
  85.  
  86.  
  87. /************** Window.c **************/
  88.  
  89. void            CalcFrameRgn(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn);
  90. /* • Called by DTS.framework. • */
  91. /* This function is the default function for contributing to the frame calculation.
  92. ** DTS.framework document scrollbars and growIcon are contributed later automatically.
  93. ** Only if you have additional (or alternate) frame parts in your window should
  94. ** you add any code to this function.  CalcFrameRgn is called by DoCalcFrameRgn
  95. ** unless you change the default frame region calculation procedure pointer.
  96. ** If you have no additional frame contribution, then you should simply return
  97. ** the region passed in unchanged. */
  98.  
  99. void            ContentClick(WindowPtr window, EventRecord *event, Boolean firstClick);
  100. /* • Called by DTS.framework. • */
  101. /* This function is the default function for handling click events for the window. */
  102.  
  103. void            ContentKey(WindowPtr window, EventRecord *event, Boolean *passThrough);
  104. /* • Called by DTS.framework. • */
  105. /* This function is the default function for handling key events for the window. */
  106.  
  107. void            DrawFrame(FileRecHndl frHndl, WindowPtr window);
  108. /* • Called by DTS.framework. • */
  109. /* This function is the default function for drawing the remainder of the
  110. ** frame.  The DTS.framework document scrollbars and growIcon, if any, are already
  111. ** drawn.  This function is called by DoDrawFrame unless you change the
  112. ** default frame drawing procedure pointer. */
  113.  
  114. void            FreeDocument(FileRecHndl frHndl);
  115. /* • Called by DTS.framework. • */
  116. /* This function is used to dispose of all allocated handles for the document. */
  117.  
  118. OSErr            FreeWindow(FileRecHndl frHndl, WindowPtr window);
  119. /* • Called by DTS.framework. • */
  120. /* This function is used to perform any additional tasks that need to be
  121. ** performed upon a window closing. */
  122.  
  123. void            ImageDocument(FileRecHndl frHndl);
  124. /* • Called by DTS.framework. • */
  125. /* This function is the default function for imaging the document into the
  126. ** window or into the printer port.  It is called in response to update
  127. ** events, or in response to the user printing.  You can change the imaging
  128. ** procedure pointer if you wish.  This is only called as a default. */
  129.  
  130. OSErr            InitContent(FileRecHndl frHndl, WindowPtr window);
  131. /* • Called by DTS.framework. • */
  132. /* This function is the default function for initializing the content area
  133. ** of a window.  It is called by DoNewWindow unless you change the default
  134. ** content initialization procedure pointer. */
  135.  
  136. OSErr            ReadDocument(FileRecHndl frHndl);
  137. /* • Called by DTS.framework. • */
  138. /* This function is called to read in the document into the designated
  139. ** file reference handle.  If the file type is of the default type, then
  140. ** DefaultReadDocument and DefaultReadDocumentFixup can be called to
  141. ** read in the document. */
  142.  
  143. void            ResizeContent(WindowPtr window, short oldh, short oldv);
  144. /* • Called by DTS.framework. • */
  145. /* This function is the default function for resizing the document content.
  146. ** The application calls DoResizeWindow, which handles resizing the document
  147. ** scrollbars.  It then calls the content resizing procedure.  This function
  148. ** is called by DoResizeWindow unless you change the default content resizing
  149. ** procedure pointer. */
  150.  
  151. void            ScrollFrame(FileRecHndl frHndl, WindowPtr window);
  152. /* • Called by DTS.framework. • */
  153. /* This function is called after a scroll event.  It is possible that any
  154. ** custom frames the application has need to be scrolled with the document.
  155. ** This is commonly the case for document rulers, and other such frame
  156. ** adornments. */
  157.  
  158. void            UndoFixup(FileRecHndl frHndl, Point contOrg, Boolean afterUndo);
  159. /* • Called by DTS.framework. • */
  160. /* This function is called to prepare for or clean up after an undo operation.
  161. ** If afterUndo is false, the undo operation hasn't started yet.  You may want
  162. ** to do pre-undo operations such as deselect anything that is currently selected.
  163. ** When an undo occurs, you usually want to have selected what was undone so that
  164. ** the user can determine more easily what the undo actually did.  This call is
  165. ** when such tasks would be done.
  166. ** Uf afterUndo is true, the undo operation has been completed.  There may be
  167. ** clean up tasks you need to do at this time.  You may simply need to redraw
  168. ** the document that was undone.  Whatever clean up needs to occur, this is 
  169. ** when it would be done. */
  170.  
  171. Boolean            WindowCursor(FileRecHndl frHndl, WindowPtr window, Point globalPt);
  172. /* • Called by DTS.framework. • */
  173. /* This function is where you adjust the cursor to reflect the location in the
  174. ** document or window.  You have the additional input of gCursorRgn to deal
  175. ** with.  The way that the cursor handling works is as follows:
  176. ** 1) The application calls DoWindowCursor().
  177. ** 2) DoWindowCursor() works its way through the windows, front to back.  It
  178. **    looks at the document's windowCursorProc and checks to see if the document
  179. **    has one.  If the document doesn't have one, then it assumes that that window
  180. **    always uses an arrow.  If the cursor is over that window, the cursor is set
  181. **    to an arrow.  If the cursor isn't over the window, then the next window is
  182. **    tried.  If all documents don't have a windowCursorProc, then the cursor is
  183. **    set to an arrow.
  184. ** 3) If a document has a windowCursorProc, then the proc is called.  The proc's
  185. **    job is as follows:
  186. **    a) If the cursor is over a position that is determined by the window, then
  187. **       the proc removes other areas from gCursorRgn.  Note that it should not
  188. **       simply set the area to what it "thinks" is the correct area.  This window
  189. **       may not be the front-most.  Other windows will have already been subtracted
  190. **       from gCursorRgn.  The resultant gCursorRgn is the correct cursor area,
  191. **       and should be passed to WaitNextEvent calls in the application.  Also,
  192. **       the cursor should be set to the correct cursor, of course.
  193. **       You should also return true, as the cursor has been determined.
  194. **    b) If the cursor is not over a position for this window, then you should
  195. **       return.  You will either pass back true or false.  If you don't wish
  196. **       windows behind this window to have a shot at cursor determination, then
  197. **       return true.  This states that the cursor is "determined".  It is, in the
  198. **       sense that no further determination will occur.  If you return false, then
  199. **       other windows get a shot at determining the cursor. */
  200.  
  201.  
  202.  
  203. void            WindowGoneFixup(WindowPtr window);
  204. /* • Called by DTS.framework. • */
  205. /* After the DTS.Lib framework disposes of a window, it calls here.  This is
  206. ** to give the application a chance to do any additional tasks related to
  207. ** a window closing.  For example:  The window that was closed might be a
  208. ** modeless dialog.  It has no related document, so just the dialog is
  209. ** closed by the framework.  The modeless DialogPtr may have been kept in
  210. ** a global, which now needs to be set to nil.  You could do that here.
  211. ** If the WindowPtr passed in is equal to the global DialogPtr, set the
  212. ** global DialogPtr to nil. */
  213.  
  214. OSErr            WriteDocument(FileRecHndl frHndl);
  215. /* • Called by DTS.framework. • */
  216. /* This function is called to write out the document from the designated
  217. ** file reference handle.  If the file type is of the default type, then
  218. ** DefaultWriteDocument can be called to read in the document. */
  219.  
  220. OSErr    DoOpenApplication(void)
  221. /* • Called by DTS.framework. • */
  222. /* This function is in case you have unusual startup things you do to your app.  AppsToGo
  223. ** effectively restarts the application it is editing when it is editing a running app.
  224. ** The application may need to be messaged about this, and so this function gets called.
  225. ** Note that this function gets called when the application normally starts up, as well. */
  226.  
  227. Boolean    AdjustMenuItems(WindowPtr window, short menuID)
  228. /* • Called by DTS.framework. • */
  229. /* The framework calls your application to adjust the menu items.  At this point, the
  230. ** items have all been disabled.  This means that your application only has to worry about
  231. ** enabling items.  (Don't forget to enable quit!!)  The framework calls this function for
  232. ** each item in the currently active 'MBAR' resource.  You just do the right thing for the
  233. ** designated menu.
  234. ** The top window's document frHndl contains a procPtr to this function.  If you change
  235. ** this procPtr, then you can cause a different AdjustMenuItems() function to be called
  236. ** for that document type.  Your choice.
  237. ** The framework also has to adjust menus for the no-window case.  In the no-window case
  238. ** this function is always called. */
  239.  
  240. Boolean    DoMenuItem(WindowPtr window, short menuID, short menuItem)
  241. /* • Called by DTS.framework. • */
  242. /* The framework calls your application to do the selected menu item.  The framework calls
  243. ** this function when the user chose a menu item either by mouse or by command-key.
  244. ** The top window's document frHndl contains a procPtr to this function.  If you change
  245. ** this procPtr, then you can cause a different DoMenuItem() function to be called
  246. ** for that document type.  Your choice.
  247. ** The framework also has to handle the no-window case.  In the no-window case
  248. ** this function is always called. */
  249.  
  250.  
  251. /* There are also two other files, WindowDialog.c, and WindowPalette.c.  These files
  252. ** have very similar functions to this one.  You can consider them parallel source files,
  253. ** but dispatching goes to the appropriate one, based on the document/window type
  254. ** (kwIsDocument, kwIsPalette, kwIsModalDialog).  WindowPalette.c is missing the
  255. ** menu handling functions.  It is assumed that the palette won't affect the state of
  256. ** the menus, and therefore the window behind it should actually be the determinator
  257. ** as to the adjustment and execution of the menu items. */
  258.  
  259.